package com.hl.card.modular.pack.service.impl;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;

import com.hl.card.common.persistence.model.Config;
import com.hl.card.modular.pack.service.ConfigService;

/**
 * 配置业务处理类
 * @author 袁伟
 *
 */
@Service
public class ConfigServiceImpl implements ConfigService{

	@Autowired
	private MongoTemplate mongoTemplate;
	
    private static String COLLECTION_NAME="config";
    
    
  

	@Override
	public List<Config> getConfig() {
	   List<Config>  list=mongoTemplate.findAll(Config.class,COLLECTION_NAME);
	   list.forEach((l)->{
		   Collections.sort(l.getConfigChilds()); 
	   });
	  return list;
	}

}
